home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr09 / fgrtodb.zip / FGR_TO_D.TXT < prev    next >
Text File  |  1993-06-03  |  4KB  |  78 lines

  1.                                                         July 15,1989
  2.  
  3.                    Putting PAF on 3x5 Index Cards, Continued
  4.  
  5. I read Don Wilson's article in the January/February 1989 digest for ideas on a 
  6. 3x5 file card output.  The PAF User Defined Report function, although useful, 
  7. doesn't include all the information, such as marriage information, one might 
  8. want to place on the index cards.  I was looking for a way of reducing and 
  9. extracting the information contained on the Family Group Records (FGR) onto a 
  10. 3x5 file card. 
  11.  
  12. Within the past year, I've taken a job that requires me to use a Unix 
  13. operating system.  I've found that there are a lot of extremely powerful text 
  14. processing tools in Unix.  Among them are sed (stream editor) and awk (a text 
  15. processing language).  Both of these tools have been ported to MS-DOS and can 
  16. be obtained as shareware from local electronic bulletin boards.  The files I 
  17. downloaded are SEDMOD.ZIP and AWK212.ZIP.
  18.  
  19. Simplistically sed copies a named file, usually an ASCII text file, to 
  20. standard output (ASCII) and edits the file according to a script of commands.  
  21. Lines can be deleted, according to parameters and characters can be 
  22. changed/deleted.  Likewise awk scans the input file for lines that match a set 
  23. of patterns specified in the program.  With each pattern in the program there 
  24. can be an associated action that will be performed when a line of the file 
  25. matching the pattern.  An input line is made up of fields separated by a field 
  26. separator (FS), usually a space.  The fields are denoted by $1, $2, ... 
  27.  
  28. The FGR is a very structured report which easily lends itself for reformatting 
  29. under sed and awk.  My goal was to convert FGRs into a standard delimited file 
  30. that could be input into dBASE III+.  Once in dBASE, I could produce the 3x5 
  31. index cards with the information I wanted.  I was able to meet that goal.  
  32. This article will show you how you can convert your FGRs.  Further 
  33. modification of the sed and awk programs maybe necessary if the output is to 
  34. be formatted differently or if additional data is needed for your research. 
  35.  
  36. The first step is to decide what group of FGRs you wish to convert.  PAF has 
  37. several options.  You can use the Cascading Pedigree or the Range Print 
  38. feature to obtain the applicable FGRs.  Select the option to print the report 
  39. to disk.  Once on disk, there are two steps necessary to convert the parent 
  40. information and three steps to convert the children information.  For my 
  41. purposes, I have assumed that all married children will have separate FGRs 
  42. printed.  Therefore, only single children are extracted from the FGRs.  If you 
  43. wish to extract all children from a FGR, then you only need to change one line 
  44. in the awk file. 
  45.  
  46. Once on disk, use sed in conjunction with listing 1 to convert the FGRs into a 
  47. format that awk can use.  I have chosen the colon to be the field separator 
  48. and have deleted all extraneous lines.  Figure 1 represents the FGR before and 
  49. figure 2 represents the FGR after being processed by sed.  The MS-DOS command 
  50. is:  
  51.  
  52.     sed -f paf.sed print.dat > print.txt
  53.  
  54. Once the file is converted, we then use awk with the program shown in listing 
  55. 2 to extract and reformat the data into a format that dBASE can accept.  
  56. Figure 3 represents the formatted output, acceptable to dBASE.  The MS-DOS 
  57. command is: 
  58.  
  59.     awk -f paf.awk print.txt > dbase.dat
  60.  
  61. Extracting the unmarried children from the same FGRs requires different sed 
  62. and awk programs (listings 3-5) and only three steps: 
  63.  
  64.     sed -f paf1.sed print.dat > print.txt
  65.     awk -f paf1.awk print.txt > dbase.txt
  66.     sed -f cleanup.sed dbase.txt > dbase.dat
  67.  
  68. The dbase.dat file produced than can be imported into dBASE III+.  The 
  69. structure of the dBASE file is shown in figure 4.  
  70.  
  71. To paraphrase Don Wilson, you now have a procedure to produce a structured 
  72. file that can be imported dBASE, or with changes, into any other format 
  73. desired.  You also have the ability to extract other pertinent genealogical 
  74. information that may not be present in PAF User Defined Reports. 
  75.  
  76.                                         Steph Valentine
  77.  
  78.